#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct ListNode
{
    int val;
    struct ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};

//两个链表的第一个公共结点，双指针
ListNode *FindFirstCommonNode(ListNode *pHead1, ListNode *pHead2)
{
    ListNode *p1, *p2;
    p1 = pHead1;
    p2 = pHead2;
    while (p1 != p2)
    {
        p1 != nullptr ? p1 = p1->next : p1 = pHead2;
        p2 != nullptr ? p2 = p2->next : p2 = pHead1;
    }
    return p1;
}

void test()
{
}

int main()
{
    test();
    return 0;
}